﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kardex_DataAccess;
using Kardex_Entity;

namespace Kardex_BussinesLogic
{
    class UserFactory
    {
        UserDA manager;
        public UserFactory()
        {
            manager = new UserDA();
        }
    /// <summary>
        /// Get obj User By Pass and UserName
    /// </summary>
    /// <param name="Password">Password of  the User</param>
    /// <param name="UserName">Name of  the User</param>
    /// <returns>Obj Of the User</returns>
        public user GetUserByPassNameUser(string Password , string UserName)
        {
            try
            {
                user UserActual;
                UserActual = manager.GetObjUserByPass_UserName(Password, UserName);
                if (UserActual.IdUser>0)
                {
                    return UserActual;                    
                }
                else
                {
                    return new user();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
    }
}
